This worked for me.
Additional info:
The "XPC Invalid" started showing up after I moved the Bluetooth stuff from the main view controller to a separate Bluetooth class.
In my main view controller, I added your suggestion at the top
I also moved these lines from the bluetooth class to the main view controller :
Thank you!